package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.SysCompeScoringAssgin;
import com.ruoyi.system.mapper.SysCompeScoringAssginMapper;
import com.ruoyi.system.mongo.StudentDao;
import com.ruoyi.system.service.ISysCompeScoringAssginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 柳
 * @Date 2021/3/3
 * @Description TODO
 * 大赛作品评审
 */
@Service
public class SysCompeScoringAssginServiceImpl implements ISysCompeScoringAssginService {
    @Autowired
    private SysCompeScoringAssginMapper sysCompeScoringAssginMapper;

    @Autowired
    private StudentDao studentDao;

    /**
     *  添加分派任务
     * @param sysCompeScoringAssgin
     */
    @Override
    public void saveSysCompeScoringAssgin(SysCompeScoringAssgin sysCompeScoringAssgin) {
        sysCompeScoringAssginMapper.saveSysCompeScoringAssgin(sysCompeScoringAssgin);
    }

    /**
     * 删除分派任务信息
     * @param user_id
     */
    @Override
    public void deleteSysCompeScoringAssginByUserId(Integer user_id) {
        sysCompeScoringAssginMapper.deleteSysCompeScoringAssginByUserId(user_id);
    }

//    /**
//     * 传入评审员id查询所有该评审员有资格评审的作品和用户信息
//     * @param userId
//     * @return
//     */
//    @Override
//    public List<SysCompeScoringAssgin> querySysCompeScoringAssginByUserId(Integer userId) {
//        List<SysCompeScoringAssgin> sysCompeScoringAssginList = sysCompeScoringAssginMapper.querySysCompeScoringAssginByUserId(userId);
////        for (SysCompeScoringAssgin sysCompeScoringAssgin : sysCompeScoringAssginList) {
////            if(sysCompeScoringAssgin.getWork_id().equals("")||sysCompeScoringAssgin.getWork_id()==null){
////                return null;
////            }
////            //根据作品id查询作品信息
////            Works works = worksService.queryWorksById(sysCompeScoringAssgin.getWork_id());
////            //根据学生id查询学生信息
////            Users users = studentDao.selectUsersByUserId(works.getUser());
////            sysCompeScoringAssgin.setNickname(users.getNickname());
////            //对象赋值
////            sysCompeScoringAssgin.setUser(works.getUser());
////            sysCompeScoringAssgin.setTitle(works.getTitle());
////            sysCompeScoringAssgin.setAbstracts(works.getAbstracts());
////            sysCompeScoringAssgin.setExplain(works.getExplain());
////        }
//
//        return sysCompeScoringAssginList;
//    }
}
